<template>
    <div class="account-login">
        <div class="container">
            <div class="row">
                <div id="content" class="col-sm-12">
                    <div class="nav-bar">会员登录</div>
                    <div class="row">
                        <div class="col-sm-12">
                            <form action="" method="post" enctype="multipart/form-data" class="form-horizontal">
                                <div class="form-group input-box">
                                    <div class="col-sm-10 input-border">
                                        <input type="text"  v-model='name' value="" placeholder="账户" id="input-email" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group input-box">
                                    <div class="col-sm-10 input-border">
                                        <input type="password" v-model='password' value="" placeholder="密码" id="input-password" class="form-control">
                                    </div>
                                </div>
                                <a v-on:click="do_login()" class="btn btn-primary btn-block">登录</a>
                                <input type="hidden" name="redirect" value="" class="mobile">
                                <div class="action-links">
                                    <a href="/#/register">用户注册</a>
                                    <a href="/#/forgotten" class="pull-right">忘记密码？</a>
                                </div>
                                <div class="omni-auth-wrapper">
                                    <p><span>其他登录方式</span></p>
                                    <div class="icons">
                                        <a >
                                            <i class="fa fa-wechat" aria-hidden="true"></i>
                                        </a>
                                        <a >
                                            <i class="fa fa-qq" aria-hidden="true"></i>
                                        </a>
                                        <a >
                                            <i class="fa fa-weibo" aria-hidden="true"></i>
                                        </a>
                                    </div>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "login",
        data:function(){

            return {
                name:'',
                password:''
            }

        },

        methods:{


            check_login:function(){
                var t = this;
                var url = this.config.app_url + '&r=member.member.status';

                this.axios.get( url ).then(function( res ){
                    if( !res.data.status ){
                        //todo 跳转页面
                        t.$router.push('/');
                    }

                });
            },

            do_login:function(){

                var t = this;
                var url = this.config.app_url + '&r=member.login.index';

                var name = '';
                var password = '';
                url += '&name=' + this.name + '&password=' + this.password;
                this.axios.get( url ).then(function( res ){
                    if( !res.data.status ){
                        //todo 跳转页面
                        t.$router.push('/');
                    }


                });

            }
        },

        created:function(){

            this.check_login();
        }

    }
</script>

<style scoped>

</style>